<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <canvas id="canvas1" width="600" height="600">

    </canvas>

    <script>
        var canvas1=document.querySelector('#canvas1')
        //2. 上下文对象 画笔
        var ctx=canvas1.getContext('2d')

        ctx.font='50px 微软雅黑'

        //设置阴影
        ctx.shadowBlur=20
        ctx.shadowColor='#000000'
        ctx.shadowOffsetX=10
        ctx.shadowOffsetY=10

        //弹幕效果
        var x=600
        setInterval(function(){
            ctx.clearRect(0,0,600,600)


            x-=10
            if(x< -100){
                x=600
            }

            ctx.fillText('helloword',x,100)
            ctx.strokeText('中午吃啥',x,100)
        },30)

    </script>

</body>
</html>